<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ include file="/common/taglibs.jsp" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>数据采集</title>
    <%@ include file="/common/util.jsp" %>
    <script src="${cdnctx}/dep/jquery/modernizr.js"></script>
    <script src="${cdnctx}/dep/jquery/spin.js"></script>
    <script type="text/javascript" src="${cdnctx }/src/collectdata/collectDataDetail.js"></script>
    <script type="text/javascript">
        errflag = false;
        $(document).ready(function () {
            //传统灯具耗电量小计
            var sum_tralightEnergy = 0;
            $(".tralightEnergy").each(function (i) {
                sum_tralightEnergy += parseFloat($(this).text());
            });
            $("#sum_tralightEnergy").text(sum_tralightEnergy.toFixed(2));

            //led耗电量小计
            var sum_ledlightEnergy = 0;
            $(".ledlightEnergy").each(function (i) {
                sum_ledlightEnergy += parseFloat($(this).text());
            });
            $("#sum_ledlightEnergy").text(sum_ledlightEnergy.toFixed(2));

            $("#economicBenefitForm").validate({
                rules: {
                    'sensorid': {
                        digits: true,
                        maxlength: 4
                    },
                    massages: {}
                }
            })
        });


        //获取该节点的详细亮灯情况
        function showDetail(gatewayid, sensorid, channelid) {
            var startTime = $("#startTime").val();
            var endTime = $("#endTime").val();
            var startDate = dateutil.format(dateutil.parse(startTime), 'yyyy-mm-dd');
            var endDate = dateutil.format(dateutil.parse(endTime), 'yyyy-mm-dd');
            // var params = {
            //     "gatewayid" : gatewayid,
            //     "sensorid" : sensorid,
            //     "channelid" : channelid,
            //     "startTime" : startTime,
            //     "endTime" : endTime
            // }
            var params = "${cdnctx}/economicBenefit/showDetail.shtml?" + "gatewayid=" + gatewayid + "&" + "sensorid=" + sensorid + "&" + "channelid=" + channelid + "&" + "startTime=" + startTime + "&" + "endTime=" + endTime;

            if (startDate == endDate) {
                $.dialog({
                    title: "亮灯情况_" + gatewayid + "_" + sensorid + "_" + channelid,
                    content: '<iframe width=600 height=350 frameborder=0 scrolling=auto src="' + params + '"></iframe>',
                    cancel: false,
                    width: 600,
                    height: 350,
                    ok: function () {
                    }
                }).show();
            } else {
                alert("请输入同一天的开始、结束日期进行查询！");
            }
        }
        function jumpPage(pageIndex) {
            window.location.href = "${cdnctx}/economicBenefit/EconomicBenefitFth.shtml?" + $.param($("#economicBenefitForm").serializeObject()) + "&pageIndex=" + pageIndex + "&customerinfoid=${customerArea.customerinfoid}" + "&areaId=${customerArea.id}";
        }

        function hide() {
            $("#showpic").hide();
            showflag = 0;
        }
    </script>
</head>
<body class="main">
<div class="-frame -style -luster" id="css_container">
    <!--首页框架页眉部分↓-->
    <%@ include file="/WEB-INF/pages/inc/header.jsp" %>
    <!--首页框架页眉部分↑-->

    <div class="content">

        <!-- Left导航菜单◎开始 -->
        <%@ include file="/WEB-INF/pages/inc/leftmenu.jsp" %>
        <!-- Left导航菜单◎结束 -->
        <div class="main-mid">
            <div class="pos">
                <img src="${cdnctx}/src/index/img/index.png"><a
                    href="${cdnctx}/system/customerinfo/customerList.shtml">能源管理 </a>><a
                    href="${cdnctx}/energy/AreaEnergy.shtml?customerinfoid=${customerInfo.id}">${customerInfo.customername} </a>><a
                    href="javascript:void(0);">${customerArea.areaname}_节点管理</a>

            </div>
            <div class="css_contentDiv">
                <form id="economicBenefitForm"
                      action="${cdnctx}/economicBenefit/EconomicBenefitFth.shtml" method="post">
                    <div style="padding:10px;">
                        <input type="hidden" name="customerinfoid" value="${customerArea.customerinfoid}"/>
                        <input type="hidden" name="areaId" value="${customerArea.id}"/>
                        <label class="search_text">开始日期:</label>
                        <input id="startTime" class="search_input Wdate" type="text" name="startTime"
                               onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="${startTime }">
                        <label class="search_text">结束日期:</label>
                        <input id="endTime" class="search_input Wdate" type="text" name="endTime"
                               onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="${endTime }">
                        <%--<label class="search_text">物联网关:</label>
                        <input type="text" class="search_input" id="gatewayid" name="gatewayid"
                               value="${areaPoint.gatewayid}">
                        <label class="search_text">采集设备节点:</label>
                        <input type="text" class="search_input" id="sensorid" name="sensorid"
                               value="${areaPoint.sensorid}">--%>
                        <input type="submit" class="search_btn" value="查&nbsp;询"/>
                        <input type="reset" class="reset_btn" value="重&nbsp;置"/>
                    </div>
                </form>

                <div class="detailDiv">
                    <table class="list_table">
                        <thead>
                        <tr>
                            <td>节点名称</td>
                            <td>物联网关</td>
                            <td>设备</td>
                            <td>通道</td>
                            <td>工作状态</td>
                            <%--<td>传统灯具功率（W）</td>--%>
                            <%--<td>传统灯具数量（只）</td>--%>
                            <%--<c:if test="${ebEntity.activetime_S != null}">--%>
                            <%--<td id="tdblue">灯具开关时间段</td>--%>
                            <%--</c:if>--%>
                            <td>节点功率（kw）</td>
                            <td>累积点亮时间（h）</td>
                            <td>耗电量（度）</td>
                            <%--<td>LED灯具功率（W）</td>--%>
                            <%--<td>LED灯具数量（只）</td>--%>
                            <%--<td id="tdyellow">传统灯具电耗(kw.h)</td>--%>
                            <%--<td id="tdyellow">LED灯具电耗(kw.h)</td>--%>
                        </tr>
                        </thead>
                        <c:if test="${empty(listdata) }">'
                            <tr class="even" style="color:red">
                                <td colspan="10" class="no-data" style="height: 300px;"></td>
                            </tr>
                        </c:if>
                        <c:if test="${not empty(listdata) }">
                            <c:forEach items="${listdata}" var="entity" varStatus="status">
                                <tr>
                                    <td>${entity.pointname}</td>
                                    <td>${entity.gatewayid}</td>
                                    <td>${entity.sensorid}</td>
                                    <td>${entity.channelid }</td>
                                    <td>${entity.statusName }</td>
                                    <td><fmt:formatNumber value="${entity.realpower/1000}" pattern="0.000"/></td>
                                        <%--<td>${entity.tralightPower}</td>--%>
                                        <%--<td>${entity.tranum}</td>--%>
                                    <td><u><a
                                            href="javascript:showDetail(${entity.gatewayid},${entity.sensorid},${entity.channelid});"><fmt:formatNumber
                                            value="${entity.useminute/60}" pattern="0.00"/></a></u></td>
                                    <td><fmt:formatNumber value="${entity.realpower*entity.useminute/60000}"
                                                          pattern="0.00"/></td>
                                        <%--<td>${entity.lednum}</td>--%>
                                        <%--<td class="tralightEnergy"--%>
                                        <%--><fmt:formatNumber value="${entity.useminute/60*entity.tralightPower*entity.tranum/1000}" pattern="0.00"/></td>--%>
                                        <%--<td class="ledlightEnergy"--%>
                                        <%--><fmt:formatNumber value="${entity.useminute/60*entity.ledlightPower*entity.lednum/1000}" pattern="0.00"/></td>--%>
                                </tr>
                            </c:forEach>
                            <%--<tr>--%>
                            <%--<td colspan="8">小计:</td>--%>
                            <%--<td id="sum_tralightEnergy"></td>--%>
                            <%--<td id="sum_ledlightEnergy"></td>--%>
                            <%--</tr>--%>
                            <tr>
                                    <%--<td  colspan="8">总计:</td>--%>
                                    <%--<td id="sum_all_tralightEnergy"><fmt:formatNumber value="${allEnergy.traPower}" pattern="0.00"/></td>--%>
                                    <%--<td id="sum_all_ledlightEnergy"><fmt:formatNumber value="${allEnergy.ledPower}" pattern="0.00"/></td>--%>
                            </tr>
                        </c:if>
                    </table>
                </div>
                <c:if test="${not empty(listdata) }">
                    <div id="pageInfo" class="pageJump">
                        <script type="text/javascript">
                            pagination.getPaginationHtml('JavaScript:jumpPage({0})', ${pageIndex}, ${pageCount}, 'pageInfo');
                        </script>
                        <c:if test="${!empty(listdata) }">
                            共有${dataCount}条数据
                        </c:if>
                    </div>
                </c:if>
            </div>
        </div>
    </div>
</div>
<!--首页框架页尾部分↓-->
<%@ include file="/WEB-INF/pages/inc/footer.jsp" %>
<!--首页框架页尾部分↑-->
</div>
</body>
</html>
